This article describes the implementation of the Android SMS transmitter. Share to everyone for your reference. Specifically as follows:
Here to simulate the implementation of the Android SMS transmitter
Androidmanifest.xml manifest file:
Main.xml Layout file:
Mainactivity class:
Packag
Maketext represents a context object, the second parameter is represented as the displayed content, the last parameter is the length of time to display the Toast, Toast.length_long indicates a slightly longer display time, toast.length_ Short indicates a slightly shorter display time, and then don't forget to call the toast's Show method to display it.
Finally, as in the previous chapter of the Phone Dialer, because the app uses system permissions, so to add a user rights to the app, add the
. The fourth parameter is also a pendingintent, and when a message is sent to the recipient, the Pendingintent is broadcast and temporarily null.3. Finally, the right to send text messages to the app, add the following code to the manifest fileandroid:name= "Android.permission.SEND_SMS"/>Finished, you can try, whether in the real machine or simulator, the code is not complex, this is learning something, the function can be better, that is later in the study in the added.Please also give us a lot
This article describes the development of Android Phone Dialer and SMS transmitter implementation methods. Share to everyone for your reference, specific as follows:
Phone Dialer
Realization principle: The user enters the telephone number, when clicks dials, by listens for the object capture, listens for the object through the text control obtains to the user to enter the telephone number, because the sys
, null);}Toast. Maketext (Mainactivity. this, r.string. success, Toast. Length_long). Show ();}}}Three notifications of successful delivery1. Status bar Notification2. dialog box notification3. Spit (Toast) (Eject sent successfully, one second automatically disappears)Set permissionsSend SMS to set permissions, we are in the SDK at docs→index.htmlHere you can see all the permissions search send SMS can see the right to send text messagescan findYou can then request permissions in manifest (under
An Android basic development small case, SMS transmitter:Code Demo diagram:Layout file:Activity_main.xmlJava code: Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Android Basic development-SMS transmitter
First look at the effect chart:
Layout file:Activity_main.xml
Java code:
Above is the Android SMS transmitter implementation code, I hope to give you a reference, but also hope that we support the cloud habitat community.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.